package com.sn.author.common.sdk.request;

import com.sn.author.common.sdk.AbstractRequest;
import com.sn.author.common.sdk.response.IMResponse;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author xiaom
 * @Date 2020/10/16 10:59
 * @Version 1.0.0
 * @Description <>
 **/

public class IMRequest extends AbstractRequest implements Request<IMResponse> {

    @Getter
    @Setter
    private List<MessageParam> pList = new ArrayList<>();

    @Getter
    @Setter
    private String phone;

    @Getter
    @Setter
    private String password;

    @Getter
    @Setter
    private String deviceId;

    @Getter
    @Setter
    public static class MessageParam{
        //发送的文本
        private String text;

        private String userId;
        /**
         * @link com.sn.author.common.enums.IMEnum
         */
        private Integer type;
    }

    @Override
    protected void setUrlParamsMap(Map<String, Object> map) {
        map.put("pList",pList);
        map.put("phone",phone);
        map.put("password",password);
        map.put("deviceId",deviceId);
    }

    @Override
    public String getApiUrl() {
        return super.getBaseUrl() + "/dy/message";
    }

    @Override
    public Class<IMResponse> getResponseClass() {
        return IMResponse.class;
    }

    @Override
    public Object getUrlParams() {
        setUrlParamsMap(super.urlParamsMap);
        return super.urlParamsMap;
    }

    @Override
    public Object initRequestParams(Map<String, String> paramsMap) {
        return null;
    }
}
